Skip to main content

user

Table Name: user

The user table stores information about users within the system, including their personal details, account status, role, and relationships to other users.


Columns

Column NameData TypeConstraintsDescription
mappedIdint(11)Primary Key, Not Null, Foreign KeyThe unique identifier for the user in the system.
createdDatedatetimeNullableThe date and time when the user account was created.
descriptionvarchar(255)NullableA brief description of the user.
emailvarchar(50)NullableThe email address of the user.
firstNamevarchar(30)Not NullThe first name of the user.
lastEditedDatedatetimeNullableThe date and time when the user details were last edited.
lastNamevarchar(30)NullableThe last name of the user.
middleNamevarchar(30)NullableThe middle name of the user.
passwordvarchar(255)NullableThe password for the user account (usually encrypted).
statusvarchar(20)NullableThe current status of the user (e.g., active, inactive).
usernamevarchar(50)Unique, Not NullThe username chosen by the user.
createdByUserIdint(11)Nullable, Foreign KeyThe user ID of the person who created this user account.
lastEditedByUserIdint(11)Nullable, Foreign KeyThe user ID of the person who last edited this user account.
passEditedDatedatetimeNullableThe date and time when the user password was last edited.
deviceTypevarchar(45)NullableThe type of device used by the user (e.g., mobile, desktop).
dateRegistereddatetimeNullableThe date and time when the user registered for the system.
gendervarchar(15)NullableThe gender of the user.
nicvarchar(20)NullableThe National Identification Card (NIC) number for the user.
organizationvarchar(45)NullableThe organization with which the user is associated (if any).
isFederalUserbit(1)NullableIndicates if the user is a federal user (1 for yes, 0 for no).
isVaccinatorbit(1)NullableIndicates if the user is a vaccinator (1 for yes, 0 for no).
tokenvarchar(255)NullableA token used for authentication or session management.

14.2 Indexes

  1. Primary Key:
    • mappedId: Uniquely identifies each user in the system.
  2. Unique Key:
    • username: Ensures that each username is unique across users.
  3. Foreign Keys:
    • FK36EBCBC79271AF:
      • References idmapper(mappedId) for the mappedId column.
      • Ensures the user's ID exists in the idmapper table.
    • user_createdByUserId_user_mappedId_FK:
      • References user(mappedId) for the createdByUserId column.
      • Links the user to the user who created their account.
    • user_lastEditedByUserId_user_mappedId_FK:
      • References user(mappedId) for the lastEditedByUserId column.
      • Links the user to the user who last edited their account details.

Foreign Key Relations

  1. FK36EBCBC79271AF:
    • Referenced Table: idmapper
    • Referenced Column: mappedId
    • Description: Ensures that each user has a corresponding mappedId in the idmapper table, enforcing data consistency across related tables.
  2. user_createdByUserId_user_mappedId_FK:
    • Referenced Table: user
    • Referenced Column: mappedId
    • Description: Links the user to the individual who created their account. This establishes a parent-child relationship between users.
  3. user_lastEditedByUserId_user_mappedId_FK:
    • Referenced Table: user
    • Referenced Column: mappedId
    • Description: Links the user to the individual who last edited their account details, tracking changes made by specific users.

Usage Notes

  • Purpose:
    • The user table maintains basic user information for individuals interacting with the system, including roles (e.g., vaccinator) and associated metadata like gender and status.
  • Key Attributes:
    • mappedId: A unique identifier for each user.
    • username: A unique login identifier.
    • createdByUserId: The user who created this account.
    • lastEditedByUserId: The user who last edited this account.